// Orderable inlines using drag and drop with jQuery UI
// http://www.djangosnippets.org/snippets/1053/
jQuery(function($) {
	$('div.inline-group').sortable({
		items: 'div.inline-related:not(:last)',
		handle: 'h3:first',
		axis: 'y',
		containment: 'parent',
		update: function() {
			$(this).find('div.inline-related').not('div.inline-related:last').each(function(i) {
				$(this).find('input[id$=order]').val(i+1);
			});
		}
	});
	$('div.inline-related:not(:last) h3').css('cursor', 'move');
	$('div.inline-related').find('input[id$=order]').parent('div').parent('div').hide();
	$('div.inline-related').find('label[for$=image]').hide();
});
